package net.csdn.business.common.domain.mirror;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import net.csdn.business.common.enums.ResultCodeEnum;
import net.csdn.business.common.exception.BusinessException;
import org.apache.commons.lang3.StringUtils;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class ProjectMirrorDataDto {
    private Long id;
    private Long projectId;
    private String repoPath;
    private String creator;
    private Boolean isImport = false;

    public void verifyRepoPath() {
        if (StringUtils.isEmpty(repoPath)) {
            return;
        }
        if (repoPath.split("/").length != 2) {
            throw new BusinessException(ResultCodeEnum.PARAMETER_ERROR_CUSTOM, "repoPath");
        }
    }
}